package lab02.test20;

import java.util.Scanner;

/**
 * Created by 阿阿阿阿豪丶 on 2017/10/31.
 */
public class Test {
    public static void main(String[] args) {

        StringBuffer str = new StringBuffer();
        System.out.println("请输入一行含有数字和字符的字符串");
        Scanner sc = new Scanner(System.in);
        String str1 = sc.next();
        for (int i = 0; i < str1.length(); i++) {
            if (str1.charAt(i) >= 48 && str1.charAt(i) <= 57) {
                str.append(str1.charAt(i));
            }
        }

        System.out.println("该字符串中的数字为：" + str.toString());

    }
}
